package cn.yuanyuan.guide.transformer.domain;

import java.util.ArrayList;
import java.util.List;

import cn.yuanyuan.guide.parser.entity.ASTNode;
import cn.yuanyuan.guide.parser.entity.Node;

/**
 * @author wuyitao
 * @date 2022/3/27 10:29 PM
 */
public class NumberLiteralVisitor implements Visitor{
    @Override
    public void enter(Node node, Node parent) {
        ASTNode astNode = (ASTNode) parent;
        List<Node> context = astNode.getContext();
        if (context == null) {
            context = new ArrayList<>();
            astNode.setContext(context);
        }
        context.add(new Node("NumberLiteral", node.getValue()));
    }

    @Override
    public void exit(Node node, Node parent) {

    }
}
